import math
import random
def getFactorial(x):
    if x == 0:
        return 1
    res = x;
    for i in range(1,x):
        res *= i
    return res

def DeCantor(n = 0,k = 0):
    array = list(range(1,n+1))
    ans = []
    k -= 1
    for i in range(n):
        Xfactorial = getFactorial(n - i - 1)
        index = k // Xfactorial
        ans.append(array[index])
        k %= Xfactorial
        array.pop(index)

    for i in range(len(ans)):
        ans[i] -= 1
    return ans

def GetBin(count,n):
    ans = str(bin(n))
    ans = ans[2:]
    while len(ans) < count:
        ans = '0' + ans
    res = []
    for i in ans:
        res.append(int(i))
    return res